/**
 * 全局样式
 * 提供基础样式和布局
 */

/* ==================== 全局重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

/* ==================== 容器布局 ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.container-fluid {
  width: 100%;
  padding: 0 15px;
}

/* ==================== 页面头部 ==================== */
.header {
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 15px 0;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 24px;
  color: #409eff;
  display: inline-block;
}

.header-actions {
  float: right;
  margin-top: 5px;
}

/* ==================== 按钮样式 ==================== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  margin: 0 5px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-primary {
  background-color: #409eff;
  color: white;
}

.btn-primary:hover {
  background-color: #66b1ff;
}

.btn-success {
  background-color: #67c23a;
  color: white;
}

.btn-success:hover {
  background-color: #85ce61;
}

.btn-warning {
  background-color: #e6a23c;
  color: white;
}

.btn-warning:hover {
  background-color: #ebb563;
}

.btn-danger {
  background-color: #f56c6c;
  color: white;
}

.btn-danger:hover {
  background-color: #f78989;
}

.btn-default {
  background-color: #fff;
  color: #606266;
  border: 1px solid #dcdfe6;
}

.btn-default:hover {
  color: #409eff;
  border-color: #409eff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

/* ==================== 卡片样式 ==================== */
.card {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ebeef5;
}

.card-body {
  padding: 10px 0;
}

/* ==================== 商品卡片 ==================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.product-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 15px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-image {
  width: 100%;
  height: 150px;
  background-color: #f5f5f5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 10px;
}

.product-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.product-price {
  font-size: 20px;
  color: #f56c6c;
  font-weight: bold;
  margin: 10px 0;
}

.product-tag {
  display: inline-block;
  padding: 2px 8px;
  background-color: #f56c6c;
  color: white;
  border-radius: 3px;
  font-size: 12px;
  margin: 5px 0;
}

.product-actions {
  margin-top: 15px;
}

/* ==================== 表单样式 ==================== */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: #409eff;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-inline .form-control {
  width: auto;
  flex: 1;
}

/* ==================== 表格样式 ==================== */
.table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ebeef5;
}

.table th {
  background-color: #f5f7fa;
  font-weight: 600;
  color: #606266;
}

.table tbody tr:hover {
  background-color: #f5f7fa;
}

/* ==================== 购物车样式 ==================== */
.cart-item {
  display: flex;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #ebeef5;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 60px;
  height: 60px;
  background-color: #f5f5f5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-right: 15px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.cart-item-price {
  color: #909399;
  font-size: 14px;
}

.cart-item-quantity {
  width: 80px;
  text-align: center;
}

.cart-item-total {
  width: 100px;
  text-align: right;
  font-size: 16px;
  font-weight: bold;
  color: #f56c6c;
}

.cart-item-actions {
  width: 80px;
  text-align: right;
}

/* ==================== 订单汇总 ==================== */
.order-summary {
  background-color: #f5f7fa;
  padding: 20px;
  border-radius: 4px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.summary-row.total {
  font-size: 20px;
  font-weight: bold;
  color: #f56c6c;
  padding-top: 10px;
  border-top: 2px solid #dcdfe6;
  margin-top: 10px;
}

/* ==================== 工具类 ==================== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.text-muted {
  color: #909399;
}

.text-primary {
  color: #409eff;
}

.text-success {
  color: #67c23a;
}

.text-danger {
  color: #f56c6c;
}

.text-warning {
  color: #e6a23c;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.ml-10 { margin-left: 10px; }
.mr-10 { margin-right: 10px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  
  .header h1 {
    font-size: 18px;
  }
  
  .header-actions {
    float: none;
    margin-top: 10px;
  }
  
  .cart-item {
    flex-wrap: wrap;
  }
  
  .cart-item-quantity,
  .cart-item-total,
  .cart-item-actions {
    width: auto;
    margin-top: 10px;
  }
}

/* ==================== 加载动画 ==================== */
.loading {
  text-align: center;
  padding: 50px;
  color: #909399;
}

.loading::after {
  content: "加载中...";
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 50px;
  color: #909399;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.empty-state-text {
  font-size: 16px;
  margin-bottom: 20px;
}

/* ==================== 标签样式 ==================== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: normal;
}

.badge-primary {
  background-color: #ecf5ff;
  color: #409eff;
}

.badge-success {
  background-color: #f0f9ff;
  color: #67c23a;
}

.badge-warning {
  background-color: #fdf6ec;
  color: #e6a23c;
}

.badge-danger {
  background-color: #fef0f0;
  color: #f56c6c;
}

/* ==================== 分割线 ==================== */
.divider {
  height: 1px;
  background-color: #ebeef5;
  margin: 20px 0;
}

/* ==================== 购物车页面样式 ==================== */

/* 购物车头部 */
.cart-header {
  margin-bottom: 20px;
  padding: 15px 0;
  border-bottom: 1px solid #e4e7ed;
}

.cart-header h3 {
  color: #303133;
  font-size: 18px;
  margin: 0;
}

/* 购物车商品卡片 */
.cart-product-card {
  position: relative;
  border: 2px solid #e4e7ed;
  transition: all 0.3s ease;
}

.cart-product-card:hover {
  border-color: #409eff;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
}

/* 购物车小计显示 */
.cart-subtotal {
  text-align: center;
  margin: 10px 0;
  padding: 8px;
  background-color: #f8f9fa;
  border-radius: 4px;
  color: #e6a23c;
  font-size: 14px;
}

/* 购物车商品网格 */
.cart-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* 购物车空状态 */
.cart-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #909399;
}

.cart-empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.cart-empty-state-text {
  font-size: 16px;
  margin-bottom: 20px;
}

/* 订单汇总样式优化 */
.order-summary {
  background-color: #fafafa;
  border-radius: 8px;
  padding: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.summary-row:last-child {
  border-bottom: none;
}

/* 优惠明细行样式 */
.summary-row.discount-detail {
  font-size: 13px;
  padding: 5px 0;
  border-bottom: none;
}

.summary-row.total {
  font-size: 16px;
  font-weight: bold;
  color: #e6a23c;
  padding-top: 15px;
  border-top: 2px solid #e4e7ed;
  margin-top: 10px;
}

/* ==================== 不可用商品样式 ==================== */
.unavailable-item {
  border: 2px solid #f56c6c !important;
  background-color: #fef0f0 !important;
  position: relative;
}

.unavailable-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(245, 108, 108, 0.05) 10px,
    rgba(245, 108, 108, 0.05) 20px
  );
  pointer-events: none;
}

.unavailable-item input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
  color: #999;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .cart-product-grid {
    grid-template-columns: 1fr;
  }
  
  .cart-header h3 {
    font-size: 16px;
  }
  
  .cart-subtotal {
    font-size: 12px;
  }
}

/* ==================== Vue防闪烁 ==================== */
/* 防止Vue模板闪烁 - 在Vue初始化完成前隐藏模板语法 */
[v-cloak] {
  display: none !important;
}

